//
//  FlexibleFrame.m
//  Show
//
//  Created by rimi on 15/6/11.
//  Copyright (c) 2015年 Chenjiani. All rights reserved.
//

#import "FlexibleFrame.h"



@implementation FlexibleFrame

+ (CGFloat)ratio
{
    if (iPhoneX) {
        return 1.103448275862069;
    }
    return [[UIScreen mainScreen] bounds].size.height/IPHONE_SCREEN.height;
}

+ (CGFloat)flexibleFloat:(CGFloat)aFloat
{
    return aFloat * [self ratio];
}

+ (CGRect)frameFromIphoneFrame:(CGRect)flexibleFrame
{
    CGFloat x = [self flexibleFloat:flexibleFrame.origin.x];
    CGFloat y = [self flexibleFloat:flexibleFrame.origin.y];
    CGFloat width = [self flexibleFloat:flexibleFrame.size.width];
    CGFloat height = [self flexibleFloat:flexibleFrame.size.height];
    return CGRectMake(x, y, width, height);
}

@end
